#ifndef UTFONT_H
#define UTFONT_H


#include "../core/String.h"
#include "../core/vector2.h"


const int UTFONT_PAGES_COUNT = 8;
const int UTFONT_CHARS_COUNT = 256;


struct UTFont
{
	UTFont() { reset(); }
	UTFont(const char* file_name) { reset(); loadFont(file_name); }

	void reset();
	void loadFont(const char* file_name);

	int getStringWidth(const String& str);
	vector2i getTextSize(const String& str);

    bool isLoaded;

	//
	//Data
	//

	String fileName;

	struct
	{
		String 	face;
		int 	size;
		int		bold;
		int 	italic;
		String	charset;
		int		unicode;
		int		stretchH;
		int		smooth;
		int		aa;
		int		padding[4];
		int		spacing[2];
		int		outline;
	} info;

	struct
	{
		int		lineHeight;
		int		base;
		int		scaleW;
		int		scaleH;
		int		pages;
		int		packed;
		int		alphaChnl;
		int		redChnl;
		int		greenChnl;
		int		blueChnl;
	} common;

	struct
	{
		int		id;
		String	file;
	} pages[UTFONT_PAGES_COUNT];

	struct
	{
		int		id;
		int		x;
		int		y;
		int		width;
		int		height;
		int		xoffset;
		int		yoffset;
		int		xadvance;
		int		page;
		int		chnl;
		int		kernings[UTFONT_CHARS_COUNT];
	} chars[UTFONT_CHARS_COUNT];
};


#endif // UTFONT_H
